// 管理员回复留言表
module.exports = app => {
  const { INTEGER, STRING, DATE, TEXT } = app.Sequelize;
  const Reply = app.model.define('reply', {
    id: { type: INTEGER, primaryKey: true, autoIncrement: true },
    nickname: { type: STRING, defaultValue: '管理员' },
    comment_id: { type: INTEGER, allowNull: false, unique: true },
    content: { type: TEXT, allowNull: false }, // 回复内容
    created_at: { type: DATE, allowNull: false, defaultValue: new Date() }, // 回复时间
  });
  Reply.associate = function() {
    app.model.Reply.belongsTo(app.model.Message, {
      foreignKey: 'comment_id',
      targetKey: 'id',
      // as: 'city',
    });
  };
  return Reply;
};
